﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utility;
using Utility.Models;
namespace JYJJ.Web.Pages
{
    public partial class detail : System.Web.UI.Page
    {
        //胡国胜
        protected string WCBL = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            donateId.Value = ParamsOfRequest.Request("id");
            model_Donate model = JYJJ.BLL.ServceHelper.ServiceDonate().GetDonateModel(donateId.Value.ToSafeInt());
            if (model != null)
            {
                imgUrl.ImageUrl = Utility.Config.ConfigHelper.WebHomeAddress_CMS + "" + model.ImageUrl.Replace("@", "");

                ltJSRQ.Text = model.Deadline.ToSafeDateTime().DateTimeToyyyy_MM_dd_HH_mm();
                ltMBJE.Text = string.Format("{0:N}", model.Target.ToSafeDecimal().ToSafeString());
                ltHDJE.Text = string.Format("{0:N}", model.Obtain.ToSafeDecimal().ToSafeString());

                WCBL = Convert.ToInt32((Math.Round((model.Obtain.ToSafeDecimal() / model.Target.ToSafeDecimal()), 2) * 100)).ToString();

                DateTime d1 = DateTime.Now;
                DateTime d2 = model.Deadline.ToSafeDateTime();
                TimeSpan d3 = d2.Subtract(d1);
                if (d3.Days > 0)
                {
                    ltSYSJ.Text = "剩余:" + d3.Days.ToString() + "天" + d3.Hours.ToString() + "小时";
                }
                else
                {
                    ltSYSJ.Text = "剩余:" + d3.Hours.ToString() + "小时";
                }
                if (d3.Days < 0)
                {
                    aSubmit.Visible = false;
                    ltSFJX.Text = "已结束";
                }
                else
                {
                    ltSFJX.Text = "进行中";
                }

                ltDesc.Text = model.Abstract;
                ltTitle.Text = model.Title;
                ltText_XMXQ.Text = model.Description;
                ltText_JTXS.Text = model.Items;
                ltText_CJWT.Text = model.FAQ;
            }
        }
    }
}